Imports Pacientes
Imports System.Data.SqlClient
Public Class frmBuscarPaciente
    Private TipoDoc As TipoDocumento = Nothing
    Private paci As Paciente = Nothing
    Private tur As Turnos = Nothing
    Private prof As Profesional = Nothing
    Dim objPacBuscado As New Paciente ' = New Paciente()
    Private idH As Integer = 0
    Private mat As Integer = 0

    Private Sub opPaciente_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles opPaciente.Click
        ' Private Sub optNuevo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles optNuevo.Click
        lblFia.Enabled = False
        txtNroFia.Enabled = False
        'btnFia.Enabled = False
        txtNroFia.Text = ""

        'cmdBuscar.Enabled = True
        txtNroDoc.Enabled = True
        lblNroDoc.Enabled = True
        lblTipo.Enabled = True
        cboTipo.Enabled = True
        cargarComboTipoDoc()

        'End Sub
    End Sub
    Private Sub cargarComboTipoDoc()
        Dim datos As DataSet = Nothing
        TipoDoc = New TipoDocumento()
        datos = TipoDoc.BuscarDatos(conexion)
        Me.cboTipo.DataSource = datos.Tables(0)
        Me.cboTipo.DisplayMember = "descrip"
        Me.cboTipo.ValueMember = "idtipodoc"
    End Sub

    Private Sub opFia_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles opFia.Click
        ' Private Sub optNuevo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles optNuevo.Click
        lblFia.Enabled = True
        txtNroFia.Enabled = True
        btnFia.Enabled = True

        'cmdBuscar.Enabled = True
        txtNroDoc.Enabled = False
        txtNroDoc.Text = ""
        cboTipo.Text = ""
        lblNroDoc.Enabled = False
        lblTipo.Enabled = False
        cboTipo.Enabled = False
        'btnPaciente.Enabled = False

        'End Sub
    End Sub

    Private Sub btnPaciente_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub
    Private Sub BuscarPacientexTNdoc()
        'Dim objPacBuscado As Paciente = New Paciente()
        Dim id As Integer = 0
        Dim numDoc As String = ""

        If cboTipo.Text = "DNI" Then
            id = 1
        End If
        If cboTipo.Text = "LC" Then
            id = 2
        End If
        If cboTipo.Text = "CI" Then
            id = 3
        End If
        If cboTipo.Text = "LE" Then
            id = 4
        End If

        numDoc = txtNroDoc.Text

        If objPacBuscado.Buscar(id, numDoc, conexion) Then
            'txtApe.Text = objPacBuscado.ApellidoPer
            'txtNom.Text = objPacBuscado.NombrePer
        End If

    End Sub

    Private Sub frmBuscarPaciente_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim datos As DataSet = Nothing
        TipoDoc = New TipoDocumento()
        datos = TipoDoc.BuscarDatos(conexion)
        Me.cboTipo.DataSource = datos.Tables(0)
        Me.cboTipo.DisplayMember = "descrip"
        Me.cboTipo.ValueMember = "idtipodoc"
    End Sub

    Private Sub btnFia_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFia.Click
        BuscarPacientexTNdoc()
        Dim formSelecFia As New frmSelecFia()

        If objPacBuscado.tipodocumentoPer = 1 Then
            formSelecFia.txtlblTipoDoc.Text = "DNI"
        End If
        If objPacBuscado.tipodocumentoPer = 2 Then
            formSelecFia.txtlblTipoDoc.Text = "LC"
        End If
        If objPacBuscado.tipodocumentoPer = 3 Then
            formSelecFia.txtlblTipoDoc.Text = "CI"
        End If
        If objPacBuscado.tipodocumentoPer = 4 Then
            formSelecFia.txtlblTipoDoc.Text = "LE"
        End If

        'formSelecFia.txtlblTipoDoc.Text = objPacBuscado.tipodocumentoPer
        formSelecFia.txtlblNroDoc.Text = objPacBuscado.NroDocumentoPer
        formSelecFia.txtlblApe.Text = objPacBuscado.ApellidoPer
        formSelecFia.txtlblNom.Text = objPacBuscado.NombrePer
        formSelecFia.Show()
    End Sub


End Class